package com.focus.xyz.main.pages;

import com.focus.xyz.core.common.keyword.Action;
import com.focus.xyz.core.pages.BasePage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

/**
 * Created by chenmeng on 2016/7/27.
 */
public class ApolloLoginPage extends BasePage{
    private Action action;

    @FindBy(xpath = "//input[@id='username']")
    private WebElement username;
    @FindBy(name = "password")
    private WebElement password;
    @FindBy(id = "loginBut")
    private WebElement loginBtn;

    public ApolloLoginPage(WebDriver driver, Action action) {
        super(driver, action);
        this.action = action;
        PageFactory.initElements(driver,this);
    }

    public void login(String user,String pass) throws Exception{
        action.inputText(username,user);
        action.inputText(password,pass);
        action.click(loginBtn);
    }
}
